obj = require('./compile.js')

//部署
account = '0xd6cc4024572ca10bffbb0d1802e1991608ad665f';
Web3 = require('web3');
web3 = new Web3();
web3.setProvider('http://localhost:8546');


myContract = new web3.eth.Contract(obj.abi);
myContract.deploy({
    data: '0x' + obj.bytecode,
}).send({
    from: account,
    gas: 1500000,
    gasPrice: '1'
}).on('transactionHash', function (transactionHash) {
    console.log("transactionHash: ", transactionHash)
}).then(myContractInstance => {
    console.log("contract addr: ", myContractInstance.options.address);
    myContractInstance.methods.getMessage().call(function (err, res) {
        console.log("res: " , res);
    });
});

